{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2024-09-12T08:39:26.230782900Z",
     "start_time": "2024-09-12T08:39:26.216923100Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "twowter\n",
      "两点水\n"
     ]
    }
   ],
   "source": [
    "#-*-coding:utf-8-*-\n",
    "\n",
    "tuple1=('两点水','twowter','liangdianshui',123,456)\n",
    "tuple2='两点水','twowter','liangdianshui',123,456\n",
    "\n",
    "print(tuple1[1])\n",
    "print(tuple2[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('两点水', 'twowater', 'liangdianshui', [123, 456])\n",
      "('两点水', 'twowater', 'liangdianshui', [789, 100])\n"
     ]
    }
   ],
   "source": [
    "#-*-coding:utf-8-*-\n",
    "list1=[123,456]\n",
    "tuple1=('两点水','twowater','liangdianshui',list1)\n",
    "print(tuple1)\n",
    "list1[0]=789\n",
    "list1[1]=100\n",
    "print(tuple1)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-09-12T08:39:28.563654200Z",
     "start_time": "2024-09-12T08:39:28.528157Z"
    }
   },
   "id": "45dde3227c3092b1"
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('两点水', 'twowter', 'liangdianshui', [123, 456])\n"
     ]
    }
   ],
   "source": [
    "#-*-coding:utf-8-*-\n",
    "\n",
    "tuple1=('两点水','twowter','liangdianshui',[123,456])\n",
    "print(tuple1)\n",
    "del tuple1"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-09-12T08:39:31.424252Z",
     "start_time": "2024-09-12T08:39:31.286232100Z"
    }
   },
   "id": "d37b4e074d8ae350"
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5\n",
      "('一点水', '两点水', '三点水', '四点水', '五点水', '1点水', '2点水', '3点水', '4点水', '5点水')\n",
      "('一点水', '两点水', '三点水', '四点水', '五点水', '一点水', '两点水', '三点水', '四点水', '五点水')\n",
      "True\n",
      "5点水\n",
      "1点水\n",
      "(1, 2, 3, 4, 5)\n"
     ]
    }
   ],
   "source": [
    "name1 = ('一点水', '两点水', '三点水', '四点水', '五点水')\n",
    "\n",
    "name2 = ('1点水', '2点水', '3点水', '4点水', '5点水')\n",
    "\n",
    "list1 = [1, 2, 3, 4, 5]\n",
    "\n",
    "# 计算元素个数\n",
    "print(len(name1))\n",
    "# 连接,两个元组相加\n",
    "print(name1 + name2)\n",
    "# 复制元组\n",
    "print(name1 * 2)\n",
    "# 元素是否存在 (name1 这个元组中是否含有一点水这个元素)\n",
    "print('一点水' in name1)\n",
    "# 元素的最大值\n",
    "print(max(name2))\n",
    "# 元素的最小值\n",
    "print(min(name2))\n",
    "# 将列表转换为元组\n",
    "print(tuple(list1))"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-09-12T08:39:36.214827100Z",
     "start_time": "2024-09-12T08:39:36.114942200Z"
    }
   },
   "id": "ee442a6f72010546"
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false
   },
   "id": "340941ce61d3c647"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
